package com.example.medicine.Mapper.yian;


import com.example.medicine.Bean.yian.yian_cankao;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface yian_cankaoMapper {
    @Select("select * from [yian_cankao]")
    public List<yian_cankao> getAll();
    @Select("select * from [yian_cankao] where yianid=#{yianid}")
    public List<yian_cankao> getByYianId(long yianid);

    @Insert("insert into [yian_cankao](yianid,name,image) values(#{yianid},#{name},#{image})")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    public void insertOne(yian_cankao yian_cankao);
    @Insert("<script>" +
            "INSERT INTO [yian_cankao] (yianid,name,image) VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.yianid},#{item.name}, #{item.image})" +
            "</foreach>" +
            "</script>")
    @Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")
    void insertBatch(List<yian_cankao> list);

    @Delete("delete from [yian_cankao] where yianid=#{yianid}")
    public void deleteByYianId(long yianid);
}
